Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use WPCOM as a proxy for Google OAuth2 flow #962

Merged
merged 7 commits into from
Jun 1, 2021

Conversation

adekbadek
Copy link
Member

@adekbadek adekbadek commented May 17, 2021

All Submissions:

Changes proposed in this Pull Request:

Changes how Google OAuth flow works to a proxy flow.

How to test the changes in this Pull Request:

  1. Ensure you're authenticated with WPCOM by visiting the Support Wizard
  2. Add a NEWSPACK_GOOGLE_OAUTH_ENABLED env variable of value true - this is effectively a feature flag that will enable us to test on production
  3. To start afresh, remove _newspack_google_oauth user meta and revoke "Newspack" app access at https://myaccount.google.com/permissions
  4. Visit the Newspack dashboard, click on the "Google OAuth2" tile and complete the auth flow. At the end the tile should feature your email address
  5. Revoke access, complete the flow again
  6. Remove the credentials from the DB (the user meta), complete the flow again
  7. Wait for at least an hour (so the credentials expire), load the dashboard and observe the token was refreshed - the site can still fetch the email address

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@adekbadek adekbadek added the [Status] Needs Review The issue or pull request needs to be reviewed label May 17, 2021
@adekbadek
Copy link
Member Author

adekbadek commented May 24, 2021

TODO: The Google OAuth relies on WPCOM auth - the latter should be handled in the dashboard, too. Otherwise, a user will not see the Google OAuth option until they authenticate via WPCOM.

Edit: this is more complicated, and I think the "connections" - Google & WPCOM - should be a separate view (wizard), to be implemented later. Added as an issue: #984

Copy link
Contributor

@claudiulodro claudiulodro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks solid! Really good work! I like that you added unit tests, also! 💯

@claudiulodro claudiulodro added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed [Status] Approved The pull request has been reviewed and is ready to merge labels May 25, 2021
@adekbadek adekbadek added [Status] Needs Review The issue or pull request needs to be reviewed and removed Do Not Merge! labels Jun 1, 2021
@adekbadek adekbadek mentioned this pull request Jun 1, 2021
@adekbadek adekbadek added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Jun 1, 2021
@adekbadek adekbadek merged commit b95fcc0 into master Jun 1, 2021
@adekbadek adekbadek deleted the feat/use-google-oauth-via-wpcom branch June 1, 2021 15:36
matticbot pushed a commit that referenced this pull request Jun 1, 2021
# [1.42.0-alpha.2](v1.42.0-alpha.1...v1.42.0-alpha.2) (2021-06-01)

### Features

* use WPCOM as a proxy for Google OAuth2 flow ([#962](#962)) ([b95fcc0](b95fcc0))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.42.0-alpha.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Jun 2, 2021
# [1.42.0](v1.41.0...v1.42.0) (2021-06-02)

### Features

* add multi-select capabillity to AutocompleteWithSuggestions ([#975](#975)) ([d7aebe2](d7aebe2))
* use WPCOM as a proxy for Google OAuth2 flow ([#962](#962)) ([b95fcc0](b95fcc0))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.42.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @alpha released [Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants